<?php
class Error {
	function __construct() {
		error_reporting ( ERR_ALL ); //value:0
		ini_set ( 'display_errors', DISPALY_ERRORS );
		ini_set ( 'log_errors', LOG_ERRORS );
		set_error_handler ( 'my_error_handler' );
	}
	//自定义错误输出函数
	function my_error_handler($number, $string, $file, $line, $context) {
		$error = "= == == == ==\nPHP ERROR\n= == == == ==\n";
		$error .= "Number: [$number]\n";
		$error .= "String: [$string]\n";
		$error .= "File: [$file]\n";
		$error .= "Line: [$line]\n";
		$error .= "Context:\n" . print_r ( $context, TRUE ) . "\n\n";
		error_log ( $error, 3, ERROR_ROOT );
	}
}
?>